FHIR RAML Auto-generator System API - Implementation Template

(0 reviews)

Setup guide

Importing Templates into Anypoint Studio

  1. In Studio, click the Exchange X icon in the upper left of the taskbar.
  2. Log in with your Anypoint Platform credentials.
  3. Search for the template.
  4. Click Open.

Running Templates in Anypoint Studio

After you import your template into Studio, follow these configuration steps to run it.

Common Configuration

  • mule.env - sets the environment where the application is to be deployed. It should be configured in config-<mule.env>.yaml file. For a studio deployment, the recommended mule.env value is local.
  • mule.key - sets the encryption password to be used for encrypting secure properties. Update as needed.
  • api.autodiscoveryID should be configured in config-<mule.env>.yaml file.

Please refer to the attached link on how to secure the configuration properties.

HTTPS Configuration

  • https.host — sets the service host interface. It should be configured in config-<mule.env>.yaml file. (Default: 0.0.0.0 for all interfaces)
  • https.port — sets the HTTPS service port number. It should be configured in config-<mule.env>.yaml file. (Default: 8082)
  • TLS Configuration - Keystore properties setup:
    • keystore.alias - sets the alias to the keystore. It should be configured in the config-<mule.env>.yaml file.
    • keystore.path - sets the path to the key file. Key should be available in /src/main/resources/keystore. It should be configured in the config-<mule.env>.yaml file.
    • keystore.keypass — sets keystore keypass to support HTTPS operation. It should be encrypted and configured in config-secured-<mule.env>.yaml file.
    • keystore.password— sets keystore password to support HTTPS operation. It should be encrypted and configured in config-secured-<mule.env>.yaml file.

Please refer to the attached link for instructions on how to generate the Keystore.

Running it

  1. Right-click the template project folder.
  2. Hover your mouse over 'Run as'.
  3. Click Mule Application (configure).
  4. Inside the dialog, select Environment and set the variable mule.env to the appropriate value (e.g., dev or local).
  5. Inside the dialog, select Environment and set the variable mule.key to the property encryption key that you used to encrypt your secure properties.
  6. Click Run.

Web Application

After deploying the application, the user can reach the web UI at /api/webapp/index.html. This UI uses the /api/list endpoint to get package and resource information. When clicking Create API, it will make a POST call to /api/build with the fields that have been entered in the form. Once the API is generated and downloaded locally, it can be uploaded to Anypoint Design Center and used in Anypoint Platform. Navigate to the custom tab from the web UI and follow the instructions to generate the specifications for an IG that is not listed in the drop-down.

hls-fhirjson-to-raml-webui

Deployment instructions for CloudHub using provided scripts

Ensure the Maven profile CloudHub-DEV has been properly configured in your settings.xml file. Reference can be found by downloading the Accelerator Common Resources asset. Additional instructions are available in the Getting Started with MuleSoft Accelerators - Build Environment guide.

Update the config-<env>.yaml properties appropriately and then use one of the following scripts to deploy the application to CloudHub:

  • packageDeploy.sh or deployOnly.sh (Mac/Linux)
  • packageDeploy.cmd or deployOnly.cmd (Windows)

Troubleshooting

There are some common problems that come up when using this converter we'd like to explain here.

  • Example Files Missing: When generating an API, sometimes you may find that the API definition references example files that don't exist. This occurs because the converter makes it's best effort to find an example to use for each library, but sometimes the names can't be easily matched or they simply don't exist in the NPM package. When they can't be found, the tool still creates the references in the API but you will need to add example files manually.
  • Errors from Example Files: There are cases where the example file structure or data do not match the specification itself. This is rare, but happens from time to time. You may see errors after importing into Design Center because of these conflicts. The issue is in the example file. You can fix the example file yourself to clear the error. It is recommended to submit feedback to the specification author through the "provide feedback" link in the API page so the example file can be fixed.
  • Special Characters in Field Names: Occasionally definition files will contain spaces or other no-alphanumeric characters in them which will be transfered to the specification and then cause an error. We look for spaces in names and correct them, but other characters we do not, so they will need to be fixed in the input specification files, or manually in the generated output RAML.

Test the template

  • Use Advanced Rest Client or Postman to send a request over HTTPS. The template includes a postman collection in the src/test/resources folder. Update the collection variable(s) after successful import.

Reviews

TypeTemplate
OrganizationMulesoft Inc.
Published by
MuleSoft Solutions
Published onMay 30, 2024
Asset overview

Asset versions for 2.0.x

Asset versions
VersionActions
2.0.7
2.0.6
2.0.5
2.0.4
2.0.3
2.0.2
2.0.1
2.0.0